﻿using Gaea.MySql;
using Gaea.Oracle;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace Gaea.Test
{
    public class TestUseVariedData
    {
        public class Test
        {

        }

        [Fact]
        public void RegisterOracleTest()
        {
            GaeaOraclePower.Register();
        }

        [Fact]
        public void OracleConnectionTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            using (var connection = gaeaOraclePower.CreateConnection())
            {

                connection.Close();
            }
        }

        [Fact]
        public void RegisterMysqlTest()
        {
            GaeaMySqlPower.Register();
        }

        [Fact]
        public void MySqlConnectionTest()
        {



            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            using (var connection = gaeaMySqlPower.CreateConnection())
            {

                connection.Close();
            }

        }

        /// <summary>
        /// Sync GaeaBasicPower 单元测试
        /// </summary>
        [Fact]
        public void QueryTest()
        {
            GaeaOraclePower.Register();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            usergroup upOracle = new usergroup();
            upOracle.GroupId = 44;
            upOracle.UserId = "asdg";
            upOracle.Id = asyncOraclePowerClass.Insert(upOracle);

            string commandText = $"select * from usergroup where id=:id";
            int parametersOracle = upOracle.Id;
            CommandType commandType = CommandType.Text;
            var TaskcountListOracle = asyncOraclePowerClass.Find<usergroup>(commandText, new { id = parametersOracle }, commandType);
            Assert.Equal(upOracle.Id, TaskcountListOracle.ToList()[0].Id);

            GaeaMySqlPower.Register();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            usergroup upMysql = new usergroup();
            upMysql.GroupId = 45;
            upMysql.UserId = "asdg1";
            upMysql.Id = asyncMysqlPowerClass.Insert(upMysql);
            string commandTextMysql = $"select * from usergroup where id=@id";
            int parametersMysql = upMysql.Id;
            var TaskcountListMysql = asyncMysqlPowerClass.Find<usergroup>(commandTextMysql, new { id = parametersMysql },commandType);

            Assert.Equal(upMysql.Id, TaskcountListOracle.ToList()[0].Id);
        }

        [Fact]
        public void QuerySingleTest()
        {
            GaeaOraclePower.Register();
            var stopwatch = new Stopwatch();
            string phonenumberOracle = string.Empty;
            stopwatch.Start();
            for (var i = 0; i < 5000; i++)
            {
                var gaeaOraclePower = new TestOraclePower();
                string commandTextOracle = $"select phonenumber from user_union_card where name=:name";
                string parametersOracle = "张彦";
                CommandType commandTypeOracle = CommandType.Text;
                phonenumberOracle = new TestOraclePower().FindOne<string>(commandTextOracle, new { name = parametersOracle }, commandTypeOracle);
            }
            stopwatch.Stop();
            Assert.Equal("18605740533", phonenumberOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select phonenumber from user_union_card where name=@name";
            string parametersMysql = "张彦";
            CommandType commandTypeMysql = CommandType.Text;
            var phonenumberMysql = new TestMySqlPower().FindOne<string>(commandTextMysql, new { name = parametersMysql }, commandTypeMysql);
            Assert.Equal("18605740533", phonenumberMysql);
        }

        [Fact]
        public void DbQuerySingleTest()
        {
            GaeaOraclePower.Register();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            string commandTextOracle = $"select phonenumber from user_union_card where name=:name";
            string parametersOracle = "张彦";
            CommandType commandType = CommandType.Text;
            var phonenumberOracle = new TestOraclePower().FindOne<string>(dbOracleConnection, commandTextOracle, new { name = parametersOracle }, commandType);
            Assert.Equal("18605740533", phonenumberOracle);

            GaeaMySqlPower.Register();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();
            string commandTextMysql = $"select phonenumber from user_union_card where name=@name";
            string parametersMysql = "张彦";
            var phonenumberMysql = new TestMySqlPower().FindOne<string>(dbMysqlConnection, commandTextMysql, new { name = parametersMysql }, commandType);
            Assert.Equal("18605740533", phonenumberMysql);
        }

        [Fact]
        public void ExecuteScalarTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"select phonenumber from user_union_card where name=:name";
            string parametersOracle = "张彦";
            CommandType commandType = CommandType.Text;
            var phonenumberOracle = new TestOraclePower().ExecuteScalar<string>(commandTextOracle, new { name = parametersOracle }, commandType);
            Assert.Equal("18605740533", phonenumberOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select phonenumber from user_union_card where name=@name";
            string parametersMysql = "张彦";
            var phonenumberMysql = new TestMySqlPower().ExecuteScalar<string>(commandTextMysql, new { name = parametersMysql }, commandType);
            Assert.Equal("18605740533", phonenumberMysql);
        }

        [Fact]
        public void DbExecuteScalarTest()
        {
            GaeaOraclePower.Register();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            string commandTextOracle = $"select phonenumber from user_union_card where name=:name";
            string parametersOracle = "张彦";
            CommandType commandType = CommandType.Text;
            var phonenumberOracle = new TestOraclePower().ExecuteScalar<string>(dbOracleConnection, commandTextOracle, new { name = parametersOracle }, commandType);
            Assert.Equal("18605740533", phonenumberOracle);

            GaeaMySqlPower.Register();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();
            string commandTextMysql = $"select phonenumber from user_union_card where name=@name";
            string parametersMysql = "张彦";
            var phonenumberMysql = new TestMySqlPower().ExecuteScalar<string>(dbMysqlConnection, commandTextMysql, new { name = parametersMysql }, commandType);
            Assert.Equal("18605740533", phonenumberMysql);
        }

        [Fact]
        public void ExecuteTest()
        {
            GaeaOraclePower.Register();
            string commandTextOracle = $"update user_union_card set phonenumber=:phonenumber where iduser=2841";
            string parametersOracle = "18100000001";
            CommandType commandType = CommandType.Text;
            var rowOracle = new TestOraclePower().Execute(commandTextOracle, new { phonenumber = parametersOracle }, commandType);
            Assert.Equal(1, rowOracle);

            GaeaMySqlPower.Register();
            string commandTextMysql = $"update user_union_card set phonenumber=@phonenumber where iduser=2841";
            string parametersMysql = "18100000001";
            var rowMysql = new TestMySqlPower().Execute(commandTextMysql, new { phonenumber = parametersMysql }, commandType);
            Assert.Equal(1, rowMysql);
        }

        [Fact]
        public void DbExecuteTest()
        {
            GaeaOraclePower.Register();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            string commandTextOracle = $"update user_union_card set phonenumber=:phonenumber where iduser=2841";
            string parametersOracle = "18100000001";
            CommandType commandType = CommandType.Text;
            var rowOracle = new TestOraclePower().Execute(dbOracleConnection, commandTextOracle, new { phonenumber = parametersOracle }, commandType);
            Assert.Equal(1, rowOracle);

            GaeaMySqlPower.Register();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();
            string commandTextMysql = $"update user_union_card set phonenumber=@phonenumber where iduser=2841";
            string parametersMysql = "18100000001";
            var rowMysql = new TestMySqlPower().Execute(dbMysqlConnection, commandTextMysql, new { phonenumber = parametersMysql }, commandType);
            Assert.Equal(1, rowMysql);
        }

        [Fact]
        public void FindAllTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var listOracle = new TestOraclePower().FindAll<user_>();
            Assert.True(listOracle.Count() > 0);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var listMysql = new TestMySqlPower().FindAll<UserAdmin>();
            Assert.True(listMysql.Count() > 0);
        }

        [Fact]
        public void FindAll3Test()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var listOracle = new TestOraclePower().FindAll<user_>(GaeaSort.ASC, "Id", 1000);
            Assert.True(listOracle.Count() > 1);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var listMysql = new TestMySqlPower().FindAll<user>(GaeaSort.ASC, "Id", 1000);
            Assert.True(listMysql.ToList()[0].Id > 1);
        }

        [Fact]
        public void FindTest()
        {
            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select * from user where id=@id";
            int parametersMysql = 45;
            var listMysql = new TestMySqlPower().Find<user>(commandTextMysql, new { id = parametersMysql });
            var guidMysql = listMysql.ToList()[0].guid;
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", guidMysql);

            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"select * from user_ where id=:id";
            int parametersOracle = 1;
            var listOracle = new TestOraclePower().Find<user_>(commandTextOracle, new { id = parametersOracle });
            var guidOracle = listOracle.ToList()[0].guid;
            Assert.Equal("111", guidOracle);
        }

        [Fact]
        public void DbFindTest()
        {
            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();
            string commandTextMysql = $"select * from user where id=@id";
            int parametersMysql = 45;
            var listMysql = new TestMySqlPower().Find<user>(dbMysqlConnection, commandTextMysql, new { id = parametersMysql });
            var guidMysql = listMysql.ToList()[0].guid;
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", guidMysql);

            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            string commandTextOracle = $"select * from user_ where id=:id";
            int parametersOracle = 1;
            var listOracle = new TestOraclePower().Find<user_>(dbOracleConnection, commandTextOracle, new { id = parametersOracle });
            var guidOracle = listOracle.ToList()[0].guid;
            Assert.Equal("111", guidOracle);
        }

        [Fact]
        public void FindOneTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"select * from user_ where id=:id";
            int parametersOracle = 1;
            var listOracle = new TestOraclePower().FindOne<user_>(commandTextOracle, new { id = parametersOracle });
            var guidOracle = listOracle.guid;
            Assert.Equal("111", guidOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select * from user where id=@id";
            int parametersMysql = 45;
            var listMysql = new TestMySqlPower().FindOne<user>(commandTextMysql, new { id = parametersMysql });
            var guidMysql = listMysql.guid;
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", guidMysql);
        }

        [Fact]
        public void DbFindOne()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            string commandTextOracle = $"select * from user_ where id=:id";
            int parametersOracle = 1;
            var UserInfoOracle = new TestOraclePower().FindOne<user_>(dbOracleConnection, commandTextOracle, new { id = parametersOracle });
            Assert.Equal("111", UserInfoOracle.guid);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select * from user where id=@id";
            int parametersMysql = 45;
            var listMysql = new TestMySqlPower().FindOne<user>(commandTextMysql, new { id = parametersMysql });
            var guid = listMysql.guid;
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", guid);
        }

        [Fact]
        public void FindByIdTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var UserInfoOracle = new TestOraclePower().FindById<user_>(1);
            Assert.Equal("111", UserInfoOracle.guid);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var UserInfoMysql = new TestMySqlPower().FindById<user>(45);
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", UserInfoMysql.guid);
        }

        [Fact]
        public void DbFindByIdTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            var UserInfoOracle = new TestOraclePower().FindById<user_>(dbOracleConnection, 1);
            Assert.Equal("111", UserInfoOracle.guid);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();
            var UserInfoMysql = new TestMySqlPower().FindById<user>(dbMysqlConnection, 45);
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", UserInfoMysql.guid);
        }

        [Fact]
        public void InsertTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var ugOracle = new usergroup();
            ugOracle.UserId = "a1";
            ugOracle.GroupId = 11;
            ugOracle.IsDeleted = 1;
            new TestOraclePower().Insert(ugOracle);
            var UserInfoOracle = new TestOraclePower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(11, UserInfoOracle.ToList()[0].GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var ugMysql = new usergroup();
            ugMysql.UserId = "a1";
            ugMysql.GroupId = 11;
            ugMysql.IsDeleted = 1;
            new TestMySqlPower().Insert(ugMysql);
            var UserInfoMysql = new TestMySqlPower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(11, UserInfoMysql.ToList()[0].GroupId);

        }

        [Fact]
        public void InsertTestFlipping()
        {
            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var ugMysql = new usergroup();
            ugMysql.UserId = "a1";
            ugMysql.GroupId = 11;
            ugMysql.IsDeleted = 1;
            new TestMySqlPower().Insert(ugMysql);
            var UserInfoMysql = new TestMySqlPower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(11, UserInfoMysql.ToList()[0].GroupId);

            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var ugOracle = new usergroup();
            ugOracle.UserId = "a1";
            ugOracle.GroupId = 11;
            ugOracle.IsDeleted = 1;
            new TestOraclePower().Insert(ugOracle);
            var UserInfoOracle = new TestOraclePower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(11, UserInfoOracle.ToList()[0].GroupId);
        }

        [Fact]
        public void DbInsertTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            var ugOracle = new usergroup();
            ugOracle.UserId = "a2";
            ugOracle.GroupId = 22;
            ugOracle.IsDeleted = 1;
            new TestOraclePower().Insert(dbOracleConnection, ugOracle);
            var UserInfoOracle = new TestOraclePower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(22, UserInfoOracle.ToList()[0].GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();
            var ugMysql = new usergroup();
            ugMysql.UserId = "a2";
            ugMysql.GroupId = 22;
            ugMysql.IsDeleted = 1;
            new TestMySqlPower().Insert(dbMysqlConnection, ugMysql);
            var UserInfoMysql = new TestMySqlPower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(22, UserInfoMysql.ToList()[0].GroupId);
        }

        [Fact]
        public void DbInsertTestFlipping()
        {
            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();
            var ugMysql = new usergroup();
            ugMysql.UserId = "a2";
            ugMysql.GroupId = 22;
            ugMysql.IsDeleted = 1;
            new TestMySqlPower().Insert(dbMysqlConnection, ugMysql);
            var UserInfoMysql = new TestMySqlPower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(22, UserInfoMysql.ToList()[0].GroupId);

            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            var ugOracle = new usergroup();
            ugOracle.UserId = "a2";
            ugOracle.GroupId = 22;
            ugOracle.IsDeleted = 1;
            new TestOraclePower().Insert(dbOracleConnection, ugOracle);
            var UserInfoOracle = new TestOraclePower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(22, UserInfoOracle.ToList()[0].GroupId);
        }

        [Fact]
        public void UpdateTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            var ugOracle = new usergroup();
            //ug.Id = 35;
            ugOracle.UserId = "a1";
            ugOracle.GroupId = 1;
            ugOracle.IsDeleted = 1;
            ugOracle.Id = oraclePowerClass.Insert(ugOracle);
            ugOracle.GroupId = 34;

            oraclePowerClass.Update(ugOracle);

            var UserInfoOracle = oraclePowerClass.FindById<usergroup>(ugOracle.Id);
            Assert.Equal(34, UserInfoOracle.GroupId);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            var ugMysql = new usergroup();
            //ug.Id = 35;
            ugMysql.UserId = "a1";
            ugMysql.GroupId = 1;
            ugMysql.IsDeleted = 1;
            ugMysql.Id = mysqlPowerClass.Insert(ugMysql);
            ugMysql.GroupId = 34;

            mysqlPowerClass.Update(ugMysql);

            var UserInfoMysql = mysqlPowerClass.FindById<usergroup>(ugMysql.Id);
            Assert.Equal(34, UserInfoMysql.GroupId);
        }

        [Fact]
        public void TInsertTest()
        {
            GaeaOraclePower.Register();
            usergroup usergroupOracle = null;
            for (var i = 1; i < 1000; i++)
            {
                var userGroupAdapter = new UserGroupAdapter();
                var id = userGroupAdapter.Insert(new usergroup()
                {
                    UserId = "a2",
                    GroupId = 2,
                    IsDeleted = 1
                });
                usergroupOracle = userGroupAdapter.FindById(id);
            }
            Assert.Equal("a2", usergroupOracle.UserId);

            GaeaMySqlPower.Register();
            usergroup usergroupMysql = null;
            for (var i = 1; i < 1000; i++)
            {
                var userGroupAdapterMysql = new UserGroupAdapter();
                var id = userGroupAdapterMysql.Insert(new usergroup()
                {
                    UserId = "a2",
                    GroupId = 2,
                    IsDeleted = 1
                });
                usergroupMysql = userGroupAdapterMysql.FindById(id);
            }
            Assert.Equal("a2", usergroupMysql.UserId);
        }

        [Fact]
        public void DbUpdateTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            IDbConnection dbOracleConnection = oraclePowerClass.CreateConnection();
            var ugOracle = new usergroup();
            //ug.Id = 37;
            ugOracle.UserId = "a2";
            ugOracle.GroupId = 2;
            ugOracle.IsDeleted = 1;
            ugOracle.Id = oraclePowerClass.Insert(dbOracleConnection, ugOracle);

            ugOracle.GroupId = 33;
            oraclePowerClass.Update(dbOracleConnection, ugOracle);
            var UserInfoOracle = oraclePowerClass.FindById<usergroup>(dbOracleConnection, ugOracle.Id);
            Assert.Equal(33, UserInfoOracle.GroupId);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            IDbConnection dbMysqlConnection = mysqlPowerClass.CreateConnection();
            var ugMysql = new usergroup();
            //ug.Id = 37;
            ugMysql.UserId = "a2";
            ugMysql.GroupId = 2;
            ugMysql.IsDeleted = 1;
            ugMysql.Id = mysqlPowerClass.Insert(dbMysqlConnection, ugMysql);

            ugMysql.GroupId = 33;
            mysqlPowerClass.Update(dbMysqlConnection, ugMysql);
            var UserInfoMysql = mysqlPowerClass.FindById<usergroup>(dbMysqlConnection, ugMysql.Id);
            Assert.Equal(33, UserInfoMysql.GroupId);
        }

        [Fact]
        public void BatchInsertTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"Insert into usergroup(UserId,GroupId,IsDeleted) values(:UserId,:GroupId,:IsDeleted)";
            var ugOracle = new usergroup();
            var ug1Oracle = new usergroup();
            ugOracle.UserId = "a3";
            ugOracle.GroupId = 33;
            ugOracle.IsDeleted = 1;
            ug1Oracle.UserId = "a4";
            ug1Oracle.GroupId = 44;
            ug1Oracle.IsDeleted = 1;
            var userListOracle = new List<usergroup>();
            userListOracle.Add(ugOracle);
            userListOracle.Add(ug1Oracle);
            int UsersOracle = new TestOraclePower().BatchInsert(commandTextOracle, userListOracle);
            var UserInfoOracle = new TestOraclePower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(44, UserInfoOracle.ToList()[0].GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"Insert into usergroup(UserId,GroupId,IsDeleted) values(@UserId,@GroupId,@IsDeleted)";
            var ugMysql = new usergroup();
            var ug1Mysql = new usergroup();
            ugMysql.UserId = "a3";
            ugMysql.GroupId = 33;
            ugMysql.IsDeleted = 1;
            ug1Mysql.UserId = "a4";
            ug1Mysql.GroupId = 44;
            ug1Mysql.IsDeleted = 1;
            var userListMysql = new List<usergroup>();
            userListMysql.Add(ugMysql);
            userListMysql.Add(ug1Mysql);
            int UsersMysql = new TestMySqlPower().BatchInsert(commandTextMysql, userListMysql);
            var UserInfoMysql = new TestMySqlPower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(44, UserInfoMysql.ToList()[0].GroupId);
        }

        [Fact]
        public void DbBatchInsertTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();
            string commandTextOracle = $"Insert into usergroup(UserId,GroupId,IsDeleted) values(:UserId,:GroupId,:IsDeleted)";
            var ugOracle = new usergroup();
            var ug1Oracle = new usergroup();
            ugOracle.UserId = "a5";
            ugOracle.GroupId = 55;
            ugOracle.IsDeleted = 1;
            ug1Oracle.UserId = "a6";
            ug1Oracle.GroupId = 66;
            ug1Oracle.IsDeleted = 1;
            var userListOracle = new List<usergroup>();
            userListOracle.Add(ugOracle);
            userListOracle.Add(ug1Oracle);
            int UsersOracle = new TestOraclePower().BatchInsert(dbOracleConnection, commandTextOracle, userListOracle);
            var UserInfoOracle = new TestOraclePower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(66, UserInfoOracle.ToList()[0].GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();
            string commandTextMysql = $"Insert into usergroup(UserId,GroupId,IsDeleted) values(@UserId,@GroupId,@IsDeleted)";
            var ugMysql = new usergroup();
            var ug1Mysql = new usergroup();
            ugMysql.UserId = "a5";
            ugMysql.GroupId = 55;
            ugMysql.IsDeleted = 1;
            ug1Mysql.UserId = "a6";
            ug1Mysql.GroupId = 66;
            ug1Mysql.IsDeleted = 1;
            var userListMysql = new List<usergroup>();
            userListMysql.Add(ugMysql);
            userListMysql.Add(ug1Mysql);
            int UsersMysql = new TestMySqlPower().BatchInsert(dbMysqlConnection, commandTextMysql, userListMysql);
            var UserInfoMysql = new TestMySqlPower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(66, UserInfoMysql.ToList()[0].GroupId);
        }

        [Fact]
        public void BatchUpdateTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();

            var ugOracle = new usergroup();
            var ug1Oracle = new usergroup();
            //ug.Id = 42;
            ugOracle.UserId = "a3";
            ugOracle.GroupId = 3;
            ugOracle.IsDeleted = 1;
            //ug1.Id = 43;
            ug1Oracle.UserId = "a4";
            ug1Oracle.GroupId = 4;
            ug1Oracle.IsDeleted = 1;

            ugOracle.Id = new TestAsyncOraclePower().Insert(ugOracle);


            ug1Oracle.Id = new TestAsyncOraclePower().Insert(ug1Oracle);

            string commandTextOracle = $"Update usergroup set UserId=:UserId,GroupId=:GroupId,IsDeleted=:IsDeleted where Id=:Id";

            var userListOracle = new List<usergroup>();
            userListOracle.Add(ugOracle);
            userListOracle.Add(ug1Oracle);
            int UsersOracle = new TestOraclePower().BatchInsert(commandTextOracle, userListOracle);
            var UserInfoOracle = new TestOraclePower().FindOne<usergroup>($"select * from usergroup where id=:id", new { id = ugOracle.Id });
            Assert.Equal(3, UserInfoOracle.GroupId);
            var UserInfo1Oracle = new TestOraclePower().FindOne<usergroup>($"select * from usergroup where id=:id", new { id = ug1Oracle.Id });
            Assert.Equal(4, UserInfo1Oracle.GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();

            var ugMysql = new usergroup();
            var ug1Mysql = new usergroup();
            //ug.Id = 42;
            ugMysql.UserId = "a3";
            ugMysql.GroupId = 3;
            ugMysql.IsDeleted = 1;
            //ug1.Id = 43;
            ug1Mysql.UserId = "a4";
            ug1Mysql.GroupId = 4;
            ug1Mysql.IsDeleted = 1;

            ugMysql.Id = new TestAsyncMySqlPower().Insert(ugMysql);


            ug1Mysql.Id = new TestAsyncMySqlPower().Insert(ug1Mysql);

            string commandTextMysql = $"Update usergroup set UserId=@UserId,GroupId=@GroupId,IsDeleted=@IsDeleted where Id=@Id";

            var userListMysql = new List<usergroup>();
            userListMysql.Add(ugMysql);
            userListMysql.Add(ug1Mysql);
            int UsersMysql = new TestMySqlPower().BatchInsert(commandTextMysql, userListMysql);
            var UserInfoMysql = new TestMySqlPower().FindOne<usergroup>($"select * from usergroup where id=@id", new { id = ugMysql.Id });
            Assert.Equal(3, UserInfoMysql.GroupId);
            var UserInfo1Mysql = new TestMySqlPower().FindOne<usergroup>($"select * from usergroup where id=@id", new { id = ug1Mysql.Id });
            Assert.Equal(4, UserInfo1Mysql.GroupId);
        }

        [Fact]
        public void DeleteTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            var ugOracle = new alipay_wap_pay_record();
            ugOracle.OrderCode = "dasdas";
            ugOracle.ReturnUrl = "2353";
            ugOracle.ShowUrl = "123";
            ugOracle.NotifyUrl = "23123";
            ugOracle.Id = oraclePowerClass.Insert(ugOracle);
            var countOracle = oraclePowerClass.Delete(ugOracle);
            Assert.Equal(1, countOracle);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            var ugMysql = new usergroup1();
            ugMysql.UserId = "333";
            ugMysql.GroupId = 56;
            ugMysql.Id = mysqlPowerClass.Insert(ugMysql);
            var countMysql = mysqlPowerClass.Delete(ugMysql);
            Assert.Equal(1, countMysql);
        }

        [Fact]
        public void DbDeleteTest()
        {
            GaeaOraclePower.Register();
            //var gaeaOraclePower = new BasicPowerClass();
            var oraclePowerClass = new TestOraclePower();
            IDbConnection dbOracleConnection = oraclePowerClass.CreateConnection();
            var ugOracle = new usergroup();
            ugOracle.UserId = "232";
            ugOracle.GroupId = 444;
            ugOracle.IsDeleted = 0;
            ugOracle.Id = oraclePowerClass.Insert(dbOracleConnection, ugOracle);
            var ug2Oracle = oraclePowerClass.FindOne<usergroup>($"select * from usergroup where Id=:Id", new { Id = ugOracle.Id });
            var countOracle = oraclePowerClass.Delete(dbOracleConnection, ug2Oracle);
            Assert.Equal(1, countOracle);

            GaeaMySqlPower.Register();
            //var gaeaMySqlPower = new BasicPowerClass();
            var mysqlPowerClass = new TestMySqlPower();
            IDbConnection dbMysqlConnection = mysqlPowerClass.CreateConnection();
            var ugMysql = new usergroup();
            ugMysql.UserId = "232";
            ugMysql.GroupId = 444;
            ugMysql.IsDeleted = 0;
            ugMysql.Id = mysqlPowerClass.Insert(dbMysqlConnection, ugMysql);
            var ug2Mysql = mysqlPowerClass.FindOne<usergroup>($"select * from usergroup where Id=@Id", new { Id = ugMysql.Id });
            var countMysql = mysqlPowerClass.Delete(dbMysqlConnection, ug2Mysql);
            Assert.Equal(1, countMysql);
       }

        [Fact]
        public void DeleteAllTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            new TestOraclePower().DeleteAll<alipay_wap_pay_record>();
            var listOracle = new TestOraclePower().FindAll<alipay_wap_pay_record>();
            Assert.Empty(listOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            new TestMySqlPower().DeleteAll<usergroup1>();
            var listMysql = new TestMySqlPower().FindAll<usergroup1>();
            Assert.Empty(listMysql);
        }

        [Fact]
        public void ModifyTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            var ugOracle = new usergroup();

            ugOracle.UserId = "a5";
            ugOracle.GroupId = 5;
            ugOracle.IsDeleted = 1;
            ugOracle.Id = oraclePowerClass.Modify(ugOracle);
            Assert.True(ugOracle.Id > 0);
            ugOracle.GroupId = 8;

            oraclePowerClass.Modify(ugOracle);

            var ug1Oracle = oraclePowerClass.FindById<usergroup>(ugOracle.Id);

            Assert.Equal(8, ug1Oracle.GroupId);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            var ugMysql = new usergroup();

            ugMysql.UserId = "a5";
            ugMysql.GroupId = 5;
            ugMysql.IsDeleted = 1;
            ugMysql.Id = mysqlPowerClass.Modify(ugMysql);
            Assert.True(ugMysql.Id > 0);
            ugMysql.GroupId = 8;

            mysqlPowerClass.Modify(ugMysql);

            var ug1Mysql = mysqlPowerClass.FindById<usergroup>(ugMysql.Id);

            Assert.Equal(8, ug1Mysql.GroupId);
        }

        [Fact]
        public void DbModifyTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            IDbConnection dbOracleConnection = new TestOraclePower().CreateConnection();

            var ug1Oracle = new usergroup();
            //ug1.Id = 0;
            ug1Oracle.UserId = "a7";
            ug1Oracle.GroupId = 7;
            ug1Oracle.IsDeleted = 1;
            var modifyidOracle = oraclePowerClass.Modify(dbOracleConnection, ug1Oracle);
            Assert.True(modifyidOracle > 0);
            ug1Oracle.Id = modifyidOracle;
            ug1Oracle.GroupId = 7;
            oraclePowerClass.Modify(dbOracleConnection, ug1Oracle);
            var ug = oraclePowerClass.FindById<usergroup>(dbOracleConnection, ug1Oracle.Id);
            Assert.Equal(7, ug.GroupId);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            IDbConnection dbMysqlConnection = new TestMySqlPower().CreateConnection();

            var ug1Mysql = new usergroup();
            //ug1.Id = 0;
            ug1Mysql.UserId = "a7";
            ug1Mysql.GroupId = 7;
            ug1Mysql.IsDeleted = 1;
            var modifyidMysql = mysqlPowerClass.Modify(dbMysqlConnection, ug1Mysql);
            Assert.True(modifyidMysql > 0);
            ug1Mysql.Id = modifyidMysql;
            ug1Mysql.GroupId = 7;
            mysqlPowerClass.Modify(dbMysqlConnection, ug1Mysql);
            var ugMysql = mysqlPowerClass.FindById<usergroup>(dbMysqlConnection, ug1Mysql.Id);
            Assert.Equal(7, ugMysql.GroupId);
        }

        [Fact]
        public void FindMultipleTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"select * from usergroup where UserId=:UserId;select * from user where id = :id;";
            var UsersOracle = new TestOraclePower().FindMultiple<usergroup, user_>(commandTextOracle, new { UserId = 2091, id = 2091 });
            Assert.Equal("15058873150", UsersOracle.Item2.ToList()[0].mobilephone);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select * from usergroup where UserId=@UserId;select * from user where id = @id;";
            var UsersMysql = new TestMySqlPower().FindMultiple<usergroup, user_>(commandTextMysql, new { UserId = 2091, id = 2091 });
            Assert.Equal("15058873150", UsersMysql.Item2.ToList()[0].mobilephone);
        }

        [Fact]
        public void GetConnectionAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            using (var connection = gaeaOraclePower.CreateConnectionAsync())
            {
                connection.Result.Close();
            }

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            using (var connection = gaeaMySqlPower.CreateConnectionAsync())
            {
                connection.Result.Close();
            }
        }

        //[Fact]
        //public async Task FindAsyncTest()
        //{
        //    GaeaOraclePower.Register();
        //    var asyncOraclePowerClass = new TestAsyncOraclePower();
        //    usergroup upOracle = new usergroup();
        //    upOracle.GroupId = 44;
        //    upOracle.UserId = "asdg";
        //    upOracle.Id = await asyncOraclePowerClass.InsertAsync(upOracle);


        //    string commandTextOracle = $"select * from usergroup where id=:id";
        //    int parametersOracle = upOracle.Id;
        //    CommandType commandType = CommandType.Text;
        //    var TaskcountListOracle = await asyncOraclePowerClass.FindAsync<usergroup>(commandTextOracle, new { id = parametersOracle }, commandType);
        //    Assert.Equal(upOracle.Id, TaskcountListOracle.ToList()[0].Id);

        //    GaeaMySqlPower.Register();
        //    var asyncMysqlPowerClass = new TestAsyncMySqlPower();
        //    usergroup upMysql = new usergroup();
        //    upMysql.GroupId = 44;
        //    upMysql.UserId = "asdg";
        //    upMysql.Id = await asyncMysqlPowerClass.InsertAsync(upMysql);


        //    string commandTextMysql = $"select * from usergroup where id=@id";
        //    int parametersMysql = upMysql.Id;
        //    CommandType commandTypeMysql = CommandType.Text;
        //    var TaskcountListMysql = await asyncMysqlPowerClass.FindAsync<usergroup>(commandTextMysql, new { id = parametersMysql }, commandType);
        //    Assert.Equal(upMysql.Id, TaskcountListMysql.ToList()[0].Id);
        //}

        //[Fact]
        //public void FindOneAsyncTest()
        //{
        //    GaeaOraclePower.Register();
        //    var gaeaOraclePower = new TestOraclePower();
        //    string commandTextOracle = $"select phonenumber from user_union_card where name=:name";
        //    string parametersOracle = "张彦";
        //    CommandType commandType = CommandType.Text;
        //    var TaskphonenumberOracle = new TestAsyncOraclePower().FindOneAsync<string>(commandTextOracle, new { name = parametersOracle }, commandType);
        //    Assert.Equal("18605740533", TaskphonenumberOracle.Result);

        //    GaeaMySqlPower.Register();
        //    var gaeaMySqlPower = new TestMySqlPower();
        //    string commandTextMysql = $"select phonenumber from user_union_card where name=@name";
        //    string parametersMysql = "张彦";
        //    var TaskphonenumberMysql = new TestAsyncMySqlPower().FindOneAsync<string>(commandTextMysql, new { name =parametersMysql }, commandType);
        //    Assert.Equal("18605740533", TaskphonenumberMysql.Result);
        //}

        //[Fact]
        //public void DbFindOneAsyncTest()
        //{
        //    GaeaOraclePower.Register();
        //    var gaeaOraclePower = new TestOraclePower();
        //    var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
        //    string commandTextOracle = $"select phonenumber from user_union_card where name=:name";
        //    string parametersOracle = "张彦";
        //    CommandType commandType = CommandType.Text;
        //    var TaskphonenumberOracle = new TestAsyncOraclePower().FindOneAsync<string>(dbOracleConnection.Result, commandTextOracle, new { name = parametersOracle }, commandType);
        //    Assert.Equal("18605740533", TaskphonenumberOracle.Result);

        //    GaeaMySqlPower.Register();
        //    var gaeaMySqlPower = new TestMySqlPower();
        //    var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
        //    string commandTextMysql = $"select phonenumber from user_union_card where name=@name";
        //    string parametersMysql = "张彦";
        //    var TaskphonenumberMysql = new TestAsyncMySqlPower().FindOneAsync<string>(dbMysqlConnection.Result, commandTextMysql, new { name = parametersMysql }, commandType);
        //    Assert.Equal("18605740533", TaskphonenumberMysql.Result);
        //}

        [Fact]
        public void ExecuteScalarAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"select phonenumber from user_union_card where name=:name";
            string parametersOracle = "张彦";
            CommandType commandType = CommandType.Text;
            var TaskphonenumberOracle = new TestAsyncOraclePower().ExecuteScalarAsync<string>(commandTextOracle, new { name =parametersOracle }, commandType);
            Assert.Equal("18605740533", TaskphonenumberOracle.Result);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select phonenumber from user_union_card where name=@name";
            string parametersMysql = "张彦";
            var TaskphonenumberMysql = new TestAsyncMySqlPower().ExecuteScalarAsync<string>(commandTextMysql, new { name =parametersMysql }, commandType);
            Assert.Equal("18605740533", TaskphonenumberMysql.Result);
        }

        [Fact]
        public void DbExecuteScalarAsync()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
            string commandTextOracle = $"select phonenumber from user_union_card where name=:name";
            string parametersOracle = "张彦";
            CommandType commandType = CommandType.Text;
            var TaskphonenumberOracle = new TestAsyncOraclePower().ExecuteScalarAsync<string>(dbOracleConnection.Result,commandTextOracle, new { name =parametersOracle }, commandType);
            Assert.Equal("18605740533", TaskphonenumberOracle.Result);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
            string commandTextMysql = $"select phonenumber from user_union_card where name=@name";
            string parametersMysql = "张彦";
            var TaskphonenumberMysql = new TestAsyncMySqlPower().ExecuteScalarAsync<string>(dbMysqlConnection.Result, commandTextMysql, new { name = parametersMysql }, commandType);
            Assert.Equal("18605740533", TaskphonenumberMysql.Result);
        }

        [Fact]
        public void ExecuteAsyncTest()
        {
            GaeaOraclePower.Register();
            string commandTextOracle = $"update usergroup set userid=:userid where groupid=1000";
            string useridOracle = "18100000002";
            CommandType commandType = CommandType.Text;
            var TaskRowOracle = new TestAsyncOraclePower().ExecuteAsync(commandTextOracle, new { useridOracle }, commandType);
            Assert.Equal(1, TaskRowOracle.Id);

            GaeaMySqlPower.Register();
            string commandTextMysql = $"update user_union_card set phonenumber=@phonenumber where iduser=2841";
            string parametersMysql = "18100000002";
            var TaskRowMysql = new TestAsyncMySqlPower().ExecuteAsync(commandTextMysql, new { phonenumber = parametersMysql }, commandType);
            Assert.Equal(1, TaskRowMysql.Result);
        }

        [Fact]
        public void DbExecuteAsyncTest()
        {
            GaeaOraclePower.Register();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
            string commandTextOracle = $"update usergroup set userid=:userid where id=147";
            string userid = "18100000002";
            CommandType commandType = CommandType.Text;
            var TaskRowOracle = new TestAsyncOraclePower().ExecuteAsync(dbOracleConnection.Result, commandTextOracle, new { userid }, commandType);
            Assert.Equal(1, TaskRowOracle.Result);

            GaeaMySqlPower.Register();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
            string commandTextMysql = $"update user_union_card set phonenumber=@phonenumber where iduser=2841";
            string parametersMysql = "18100000001";
            var TaskRowMysql = new TestAsyncMySqlPower().ExecuteAsync(dbMysqlConnection.Result, commandTextMysql, new { phonenumber = parametersMysql }, commandType);
            Assert.Equal(1, TaskRowMysql.Result);
        }

        [Fact]
        public void FindAllAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var TaskListOracle = new TestAsyncOraclePower().FindAllAsync<user_>();
            var resultOracle = TaskListOracle.Result;
            Assert.True(resultOracle.Count() > 1);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var TaskListMysql = new TestAsyncMySqlPower().FindAllAsync<usergroup>();
            var resultMysql = TaskListMysql.Result;
            Assert.True(resultMysql.Count() > 1);
        }

        [Fact]
        public void FindAll3AsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var TaskListOracle = new TestAsyncOraclePower().FindAllAsync<User_Admin>(GaeaSort.ASC, "Id", 1000);
            if (TaskListOracle.Result.Count() > 0)
            {
                var idOracle = TaskListOracle.Result.ToList()[0].Id;
                Assert.True(idOracle == 1);
            }


            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var TaskListMysql = new TestAsyncMySqlPower().FindAllAsync<UserAdmin>(GaeaSort.ASC, "Id", 1000);
            if (TaskListOracle.Result.Count() > 0)
            {
                var idMysql = TaskListMysql.Result.ToList()[0].Id;
                Assert.True(idMysql == 1);
            }
        }

        [Fact]
        public void FindAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"select * from user_ where id=:id";
            int parametersOracle = 1;
            var TaskListOracle = new TestAsyncOraclePower().FindAsync<user_>(commandTextOracle, new { id = parametersOracle });
            var guidOracle = TaskListOracle.Result.ToList()[0].guid;
            Assert.Equal("111", guidOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select * from user where id=@id";
            int parametersMysql = 45;
            var TaskListMysql = new TestAsyncMySqlPower().FindAsync<user_>(commandTextMysql, new { id = parametersMysql });
            var guidMysql = TaskListMysql.Result.ToList()[0].guid;
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", guidMysql);
        }

        [Fact]
        public void DbFindAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
            string commandTextOracle = $"select * from user_ where id=:id";
            int parametersOracle = 1;
            var TaskListOracle = new TestAsyncOraclePower().FindAsync<user_>(dbOracleConnection.Result, commandTextOracle, new { id = parametersOracle });
            var guidOracle = TaskListOracle.Result.ToList()[0].guid;
            Assert.Equal("111", guidOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
            string commandTextMysql = $"select * from user where id=@id";
            int parametersMysql = 45;
            var TaskListMysql = new TestAsyncMySqlPower().FindAsync<user_>(dbMysqlConnection.Result, commandTextMysql, new { id =parametersMysql });
            var guidMysql = TaskListMysql.Result.ToList()[0].guid;
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", guidMysql);
        }

        [Fact]
        public void FindOneAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"select * from user_ where id=:id";
            int parametersOracle = 1;
            var TaskListOracle = new TestAsyncOraclePower().FindAsync<user_>(commandTextOracle, new { id = parametersOracle });
            var guidOracle = TaskListOracle.Result.ToList()[0].guid;
            Assert.Equal("111", guidOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select * from user where id=@id";
            int parametersMysql = 45;
            var TaskListMysql = new TestAsyncMySqlPower().FindAsync<user_>(commandTextMysql, new { id = parametersMysql });
            var guidMysql = TaskListMysql.Result.ToList()[0].guid;
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", guidMysql);
        }

        [Fact]
        public void DbFindOneAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
            string commandTextOracle = $"select * from user_ where id=:id";
            int parametersOracle = 1;
            var TaskListOracle = new TestAsyncOraclePower().FindAsync<user_>(dbOracleConnection.Result, commandTextOracle, new { id = parametersOracle });
            var guidOracle = TaskListOracle.Result.ToList()[0].guid;
            Assert.Equal("111", guidOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
            string commandTextMysql = $"select * from user where id=@id";
            int parametersMysql = 45;
            var TaskListMysql = new TestAsyncMySqlPower().FindAsync<user_>(dbMysqlConnection.Result, commandTextMysql, new { id = parametersMysql });
            var guidMysql = TaskListMysql.Result.ToList()[0].guid;
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", guidMysql);
        }

        [Fact]
        public void FindByIdAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var TaskUserInfoOracle = new TestAsyncOraclePower().FindByIdAsync<user_>(1);
            Assert.Equal("111", TaskUserInfoOracle.Result.guid);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var TaskUserInfoMysql = new TestAsyncMySqlPower().FindByIdAsync<user>(45);
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", TaskUserInfoMysql.Result.guid);
        }

        [Fact]
        public void DbFindByIdAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
            var TaskUserInfoOracle = new TestAsyncOraclePower().FindByIdAsync<user_>(dbOracleConnection.Result, 1);
            Assert.Equal("111", TaskUserInfoOracle.Result.guid);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
            var TaskUserInfoMysql = new TestAsyncMySqlPower().FindByIdAsync<user>(dbMysqlConnection.Result, 45);
            Assert.Equal("31d166ade7894f5dbd1cf6d3670d9c8f", TaskUserInfoMysql.Result.guid);
        }

        [Fact]
        public async Task InsertAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var ugOracle = new usergroup();
            ugOracle.UserId = "a7";
            ugOracle.GroupId = 77;
            ugOracle.IsDeleted = 1;
            await new TestAsyncOraclePower().InsertAsync(ugOracle);
            var UserInfoOracle = new TestOraclePower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(77, UserInfoOracle.ToList()[0].GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var ugMysql = new usergroup();
            ugMysql.UserId = "a7";
            ugMysql.GroupId = 77;
            ugMysql.IsDeleted = 1;
            await new TestAsyncMySqlPower().InsertAsync(ugMysql);
            var UserInfoMysql = new TestMySqlPower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(77, UserInfoMysql.ToList()[0].GroupId);
        }

        [Fact]
        public async Task DbInsertAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
            var ugOracle = new usergroup();
            ugOracle.UserId = "a8";
            ugOracle.GroupId = 88;
            ugOracle.IsDeleted = 1;
            await new TestAsyncOraclePower().InsertAsync(dbOracleConnection.Result, ugOracle);
            var UserInfoOracle = new TestOraclePower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(88, UserInfoOracle.ToList()[0].GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
            var ugMysql = new usergroup();
            ugMysql.UserId = "a8";
            ugMysql.GroupId = 88;
            ugMysql.IsDeleted = 1;
            await new TestAsyncMySqlPower().InsertAsync(dbMysqlConnection.Result,ugMysql);
            var UserInfoMysql = new TestMySqlPower().Find<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(88, UserInfoMysql.ToList()[0].GroupId);
        }

        [Fact]
        public async Task UpdateAsyncTest()
        {
            GaeaOraclePower.Register();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            var ugOracle = new usergroup();
            //ug.Id = 46;
            ugOracle.UserId = "a7";
            ugOracle.GroupId = 7;
            ugOracle.IsDeleted = 1;
            ugOracle.Id = await asyncOraclePowerClass.InsertAsync(ugOracle);
            ugOracle.GroupId = 199;

            await asyncOraclePowerClass.UpdateAsync(ugOracle);
            var TaskUserInfoOracle = asyncOraclePowerClass.FindByIdAsync<usergroup>(ugOracle.Id);
            Assert.Equal(199,TaskUserInfoOracle.Result.GroupId);

            GaeaMySqlPower.Register();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            var ugMysql = new usergroup();
            //ug.Id = 46;
            ugMysql.UserId = "a7";
            ugMysql.GroupId = 7;
            ugMysql.IsDeleted = 1;
            ugMysql.Id = await asyncMysqlPowerClass.InsertAsync(ugMysql);
            ugMysql.GroupId = 199;

            await asyncMysqlPowerClass.UpdateAsync(ugMysql);
            var TaskUserInfoMysql = asyncMysqlPowerClass.FindByIdAsync<usergroup>(ugMysql.Id);
            Assert.Equal(199, TaskUserInfoMysql.Result.GroupId);
        }

        [Fact]
        public async System.Threading.Tasks.Task DbUpdateAsyncTest()
        {
            GaeaOraclePower.Register();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            var ugOracle = new usergroup();
            var dbOracleConnection = await asyncOraclePowerClass.CreateConnectionAsync();
            //ug.Id = 47;
            ugOracle.UserId = "a8";
            ugOracle.GroupId = 8;
            ugOracle.IsDeleted = 1;
            ugOracle.Id = await asyncOraclePowerClass.InsertAsync(dbOracleConnection, ugOracle);

            ugOracle.GroupId = 99;

            await asyncOraclePowerClass.UpdateAsync(dbOracleConnection, ugOracle);
            var TaskUserInfoOracle = await asyncOraclePowerClass.FindByIdAsync<usergroup>(dbOracleConnection,ugOracle.Id);
            Assert.Equal(99, TaskUserInfoOracle.GroupId);

            GaeaMySqlPower.Register();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            var ugMysql = new usergroup();
            var dbConnection = await asyncMysqlPowerClass.CreateConnectionAsync();
            //ug.Id = 47;
            ugMysql.UserId = "a8";
            ugMysql.GroupId = 8;
            ugMysql.IsDeleted = 1;
            ugMysql.Id = await asyncMysqlPowerClass.InsertAsync(dbConnection, ugMysql);

            ugMysql.GroupId = 99;

            await asyncMysqlPowerClass.UpdateAsync(dbConnection, ugMysql);
            var TaskUserInfo = await asyncMysqlPowerClass.FindByIdAsync<usergroup>(dbConnection, ugMysql.Id);
            Assert.Equal(99, TaskUserInfo.GroupId);
        }

        [Fact]
        public async System.Threading.Tasks.Task BatchInsertAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"Insert into usergroup(UserId,GroupId,IsDeleted) values(:UserId,:GroupId,:IsDeleted)";
            var ugOracle = new usergroup();
            var ug1Oracle = new usergroup();
            ugOracle.UserId = "a9";
            ugOracle.GroupId = 99;
            ugOracle.IsDeleted = 1;
            ug1Oracle.UserId = "a10";
            ug1Oracle.GroupId = 1010;
            ug1Oracle.IsDeleted = 1;
            var userListOracle = new List<usergroup>();
            userListOracle.Add(ugOracle);
            userListOracle.Add(ug1Oracle);
            int UsersOracle = await new TestAsyncOraclePower().BatchInsertAsync(commandTextOracle, userListOracle);
            var TaskUserInfoOracle = new TestAsyncOraclePower().FindAsync<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(1010, TaskUserInfoOracle.Result.ToList()[0].GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"Insert into usergroup(UserId,GroupId,IsDeleted) values(@UserId,@GroupId,@IsDeleted)";
            var ugMysql = new usergroup();
            var ug1Mysql = new usergroup();
            ugMysql.UserId = "a9";
            ugMysql.GroupId = 99;
            ugMysql.IsDeleted = 1;
            ug1Mysql.UserId = "a10";
            ug1Mysql.GroupId = 1010;
            ug1Mysql.IsDeleted = 1;
            var userListMysql = new List<usergroup>();
            userListMysql.Add(ugMysql);
            userListMysql.Add(ug1Mysql);
            int UsersMysql = await new TestAsyncMySqlPower().BatchInsertAsync(commandTextMysql, userListMysql);
            var TaskUserInfoMysql = new TestAsyncMySqlPower().FindAsync<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(1010, TaskUserInfoMysql.Result.ToList()[0].GroupId);
        }

        [Fact]
        public async System.Threading.Tasks.Task DbBatchInsertAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
            string commandTextOracle = $"Insert into usergroup(UserId,GroupId,IsDeleted) values(:UserId,:GroupId,:IsDeleted)";
            var ugOracle = new usergroup();
            var ug1Oracle = new usergroup();
            ugOracle.UserId = "a11";
            ugOracle.GroupId = 1111;
            ugOracle.IsDeleted = 1;
            ug1Oracle.UserId = "a12";
            ug1Oracle.GroupId = 1212;
            ug1Oracle.IsDeleted = 1;
            var userListOracle = new List<usergroup>();
            userListOracle.Add(ugOracle);
            userListOracle.Add(ug1Oracle);
            int UsersOracle = await new TestAsyncOraclePower().BatchInsertAsync(dbOracleConnection.Result, commandTextOracle, userListOracle);
            var TaskUserInfoOracle = new TestAsyncOraclePower().FindAsync<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(1212, TaskUserInfoOracle.Result.ToList()[0].GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
            string commandTextMysql = $"Insert into usergroup(UserId,GroupId,IsDeleted) values(@UserId,@GroupId,@IsDeleted)";
            var ugMysql = new usergroup();
            var ug1Mysql = new usergroup();
            ugMysql.UserId = "a11";
            ugMysql.GroupId = 1111;
            ugMysql.IsDeleted = 1;
            ug1Mysql.UserId = "a12";
            ug1Mysql.GroupId = 1212;
            ug1Mysql.IsDeleted = 1;
            var userListMysql = new List<usergroup>();
            userListMysql.Add(ugMysql);
            userListMysql.Add(ug1Mysql);
            int UsersMysql = await new TestAsyncMySqlPower().BatchInsertAsync(dbMysqlConnection.Result, commandTextMysql, userListMysql);
            var TaskUserInfoMysql = new TestAsyncMySqlPower().FindAsync<usergroup>($"select * from usergroup order by id desc", new { });
            Assert.Equal(1212, TaskUserInfoMysql.Result.ToList()[0].GroupId);
        }

        [Fact]
        public async System.Threading.Tasks.Task BatchUpdateAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var ugOracle = new usergroup();
            var ug1Oracle = new usergroup();
            //ug.Id = 62;
            ugOracle.UserId = "a11";
            ugOracle.GroupId = 11;
            ugOracle.IsDeleted = 1;
            ugOracle.Id = await new TestAsyncOraclePower().InsertAsync(ugOracle);

            //ug1.Id = 63;
            ug1Oracle.UserId = "a12";
            ug1Oracle.GroupId = 12;
            ug1Oracle.IsDeleted = 1;
            ug1Oracle.Id = await new TestAsyncOraclePower().InsertAsync(ug1Oracle);

            var userListOracle = new List<usergroup>();
            userListOracle.Add(ugOracle);
            userListOracle.Add(ug1Oracle);

            string commandTextOracle = $"Update usergroup set UserId=:UserId,GroupId=:GroupId,IsDeleted=:IsDeleted where Id=:Id";

            int UsersOracle = await new TestAsyncOraclePower().BatchUpdateAsync(commandTextOracle, userListOracle);
            var TaskUserInfoOracle = new TestAsyncOraclePower().FindOneAsync<usergroup>($"select * from usergroup where id = :id", new { id =ugOracle.Id }).Result;
            Assert.Equal(11, TaskUserInfoOracle.GroupId);
            var TaskUserInfo1Oracle = new TestAsyncOraclePower().FindOneAsync<usergroup>($"select * from usergroup where id = :id", new { id = ug1Oracle.Id });
            Assert.Equal(12, TaskUserInfo1Oracle.Result.GroupId);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var ugMySql = new usergroup();
            var ug1MySql = new usergroup();
            //ug.Id = 62;
            ugMySql.UserId = "a11";
            ugMySql.GroupId = 11;
            ugMySql.IsDeleted = 1;
            ugMySql.Id = await new TestAsyncMySqlPower().InsertAsync(ugMySql);

            //ug1.Id = 63;
            ug1MySql.UserId = "a12";
            ug1MySql.GroupId = 12;
            ug1MySql.IsDeleted = 1;
            ug1MySql.Id = await new TestAsyncMySqlPower().InsertAsync(ug1MySql);

            var userListMySql = new List<usergroup>();
            userListMySql.Add(ugMySql);
            userListMySql.Add(ug1MySql);

            string commandTextMySql = $"Update usergroup set UserId=@UserId,GroupId=@GroupId,IsDeleted=@IsDeleted where Id=@Id";

            int UsersMySql = await new TestAsyncMySqlPower().BatchUpdateAsync(commandTextMySql, userListMySql);
            var TaskUserInfoMySql = new TestAsyncMySqlPower().FindOneAsync<usergroup>($"select * from usergroup where id = @id", new { id =ugMySql.Id }).Result;
            Assert.Equal(11, TaskUserInfoMySql.GroupId);
            var TaskUserInfo1MySql = new TestAsyncMySqlPower().FindOneAsync<usergroup>($"select * from usergroup where id = @id", new { id = ug1MySql.Id });
            Assert.Equal(12, TaskUserInfo1MySql.Result.GroupId);
        }

        [Fact]
        public async System.Threading.Tasks.Task DeleteAsyncTest()
        {
            GaeaOraclePower.Register();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            var ugOracle = new alipay_wap_pay_record();
            ugOracle.OrderCode = "dasdas";
            ugOracle.ReturnUrl = "2353";
            ugOracle.ShowUrl = "123";
            ugOracle.NotifyUrl = "23123";
            ugOracle.Id = await asyncOraclePowerClass.InsertAsync(ugOracle);
            var countOracle = await asyncOraclePowerClass.DeleteAsync(ugOracle);
            Assert.Equal(1, countOracle);

            GaeaMySqlPower.Register();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            var ugMysql = new usergroup1();
            ugMysql.GroupId = 32;
            ugMysql.UserId = "2353";
            ugMysql.Id = await asyncMysqlPowerClass.InsertAsync(ugMysql);
            var countMysql = await asyncMysqlPowerClass.DeleteAsync(ugMysql);
            Assert.Equal(1, countMysql);
        }

        [Fact]
        public async System.Threading.Tasks.Task DbDeleteAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            var dbOracleConnection = asyncOraclePowerClass.CreateConnectionAsync();
            var ugOracle = new usergroup();
            ugOracle.UserId = "232";
            ugOracle.GroupId = 444;
            ugOracle.IsDeleted = 0;
            ugOracle.Id = await asyncOraclePowerClass.InsertAsync(dbOracleConnection.Result, ugOracle);
            var ug1Oracle = await asyncOraclePowerClass.FindOneAsync<usergroup>($"select * from usergroup where Id=:Id", new { Id = ugOracle.Id });
            var countOracle = asyncOraclePowerClass.Delete(dbOracleConnection.Result, ug1Oracle);
            Assert.Equal(1, countOracle);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            var dbMysqlConnection = asyncMysqlPowerClass.CreateConnectionAsync();
            var ugMysql = new usergroup();
            ugMysql.UserId = "232";
            ugMysql.GroupId = 444;
            ugMysql.IsDeleted = 0;
            ugMysql.Id = await asyncMysqlPowerClass.InsertAsync(dbMysqlConnection.Result, ugMysql);
            var ug1Mysql = await asyncMysqlPowerClass.FindOneAsync<usergroup>($"select * from usergroup where Id=@Id", new { Id = ugMysql.Id });
            var countMysql = asyncMysqlPowerClass.Delete(dbMysqlConnection.Result,ug1Mysql);
            Assert.Equal(1, countMysql);
        }

        [Fact]
        public async System.Threading.Tasks.Task DeleteAllAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            await new TestAsyncOraclePower().DeleteAllAsync<alipay_wap_pay_record>();
            var TasklistOracle = new TestAsyncOraclePower().FindAllAsync<alipay_wap_pay_record>();
            Assert.Empty(TasklistOracle.Result);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            await new TestAsyncMySqlPower().DeleteAllAsync<usergroup1>();
            var TasklistMysql = new TestAsyncMySqlPower().FindAllAsync<usergroup1>();
            Assert.Empty(TasklistMysql.Result);
        }

        [Fact]
        public async Task ModifyAsyncTest()
        {
            GaeaOraclePower.Register();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            //var ug = new usergroup();
            //ug.Id = 62;
            //ug.UserId = "a11";
            //ug.GroupId = 11;
            //ug.IsDeleted = 1;
            //var Taskcount = asyncBasicPowerClass.ModifyAsync(ug);
            //Assert.Equal(1, Taskcount.Result);
            var ug1Oracle = new usergroup();
            //ug1.Id = 0;
            ug1Oracle.UserId = "a13";
            ug1Oracle.GroupId = 13;
            ug1Oracle.IsDeleted = 1;
            var TaskmodifyidOracle = await asyncOraclePowerClass.ModifyAsync(ug1Oracle);
            Assert.True(TaskmodifyidOracle > 0);
            ug1Oracle.Id = TaskmodifyidOracle;
            ug1Oracle.GroupId = 66;
            await asyncOraclePowerClass.ModifyAsync(ug1Oracle);
            var ugOracle = asyncOraclePowerClass.FindById<usergroup>(TaskmodifyidOracle);
            Assert.Equal(66, ugOracle.GroupId);

            GaeaMySqlPower.Register();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            //var ug = new usergroup();
            //ug.Id = 62;
            //ug.UserId = "a11";
            //ug.GroupId = 11;
            //ug.IsDeleted = 1;
            //var Taskcount = asyncBasicPowerClass.ModifyAsync(ug);
            //Assert.Equal(1, Taskcount.Result);
            var ug1Mysql = new usergroup();
            //ug1.Id = 0;
            ug1Mysql.UserId = "a13";
            ug1Mysql.GroupId = 13;
            ug1Mysql.IsDeleted = 1;
            var TaskmodifyidMysql = await asyncMysqlPowerClass.ModifyAsync(ug1Mysql);
            Assert.True(TaskmodifyidMysql > 0);
            ug1Mysql.Id = TaskmodifyidMysql;
            ug1Mysql.GroupId = 66;
            await asyncMysqlPowerClass.ModifyAsync(ug1Mysql);
            var ug = asyncMysqlPowerClass.FindById<usergroup>(TaskmodifyidMysql);
            Assert.Equal(66, ug.GroupId);

        }

        [Fact]
        public async void DbModifyAsyncTest()
        {
            GaeaOraclePower.Register();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            var dbOracleConnection = asyncOraclePowerClass.CreateConnectionAsync();

            var ug1Oracle = new usergroup();
            //ug1.Id = 0;
            ug1Oracle.UserId = "a14";
            ug1Oracle.GroupId = 14;
            ug1Oracle.IsDeleted = 1;
            var TaskmodifyidOracle = await asyncOraclePowerClass.ModifyAsync(dbOracleConnection.Result, ug1Oracle);
            Assert.True(TaskmodifyidOracle > 0);

            ug1Oracle.Id = TaskmodifyidOracle;
            ug1Oracle.GroupId = 16;
            await asyncOraclePowerClass.ModifyAsync(dbOracleConnection.Result,ug1Oracle);
            var ugOracle = await asyncOraclePowerClass.FindByIdAsync<usergroup>(dbOracleConnection.Result, ug1Oracle.Id);
            Assert.Equal(16, ugOracle.GroupId);

            GaeaMySqlPower.Register();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            var dbMysqlConnection = asyncMysqlPowerClass.CreateConnectionAsync();

            var ug1Mysql = new usergroup();
            //ug1.Id = 0;
            ug1Mysql.UserId = "a14";
            ug1Mysql.GroupId = 14;
            ug1Mysql.IsDeleted = 1;
            var TaskmodifyidMysql = await asyncMysqlPowerClass.ModifyAsync(dbMysqlConnection.Result, ug1Mysql);
            Assert.True(TaskmodifyidMysql > 0);

            ug1Mysql.Id = TaskmodifyidMysql;
            ug1Mysql.GroupId = 16;
            await asyncMysqlPowerClass.ModifyAsync(dbMysqlConnection.Result, ug1Mysql);
            var ugMysql = await asyncMysqlPowerClass.FindByIdAsync<usergroup>(dbMysqlConnection.Result, ug1Mysql.Id);
            Assert.Equal(16, ugMysql.GroupId);
        }

        [Fact]
        public void FindMultipleAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            string commandTextOracle = $"select * from usergroup where UserId=:UserId;select * from user where id = :id;";
            var TaskUsersOracle = new TestAsyncOraclePower().FindMultipleAsync<usergroup, user_>(commandTextOracle, new { UserId = 2091, id = 2091 });
            Assert.Equal("15058873150", TaskUsersOracle.Result.Item2.ToList()[0].mobilephone);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            string commandTextMysql = $"select * from usergroup where UserId=@UserId;select * from user where id = @id;";
            var TaskUsersMysql = new TestAsyncMySqlPower().FindMultipleAsync<usergroup, user_>(commandTextMysql, new { UserId = 2091, id = 2091 });
            Assert.Equal("15058873150", TaskUsersMysql.Result.Item2.ToList()[0].mobilephone);
        }

        [Fact]
        public async Task ConnectionAsync()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();

            Assert.NotEqual(dbOracleConnection,dbMysqlConnection);
        }

        [Fact]
        public  void GetTableName()
        {
            GaeaOraclePower.Register();
            var getTableNameByOracle = new GetTableNameByOracle();
            string tableNameForOracle = getTableNameByOracle.GaeaName;
            Assert.Equal("alipay_wap_pay_record", tableNameForOracle);

            GaeaMySqlPower.Register();
            var getTableNameByMysql = new GetTableNameByMysql();
            string tableNameForMysql = getTableNameByMysql.GaeaName;
            Assert.Equal("alipay_wap_pay_record", tableNameForMysql);
        }

        [Fact]
        public void ExcludeTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var listOracle = new TestOraclePower().FindAll<user_coin>();
            Assert.True(listOracle.Count() > 0);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var listMysql = new TestMySqlPower().FindAll<adminuser>();
            Assert.True(listMysql.Count() > 0);
        }

        [Fact]
        public void ExcludeDbInsertTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            IDbConnection dbOracleConnection = oraclePowerClass.CreateConnection();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = oraclePowerClass.Insert(dbOracleConnection, ugOracle);

            var UserInfoOracle = oraclePowerClass.FindById<user_coin>(dbOracleConnection, ugOracle.Id);
            Assert.Equal(100000, UserInfoOracle.iduser);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            IDbConnection dbMysqlConnection = mysqlPowerClass.CreateConnection();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = mysqlPowerClass.Insert(dbMysqlConnection, ugMysql);

            var UserInfoMysql = mysqlPowerClass.FindById<usercoin>(dbMysqlConnection, ugMysql.Id);
            Assert.Equal(0, UserInfoMysql.iduser);
        }

        [Fact]
        public void ExcludeInsertTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = new TestOraclePower().Insert(ugOracle);
            var UserInfoOracle = new TestOraclePower().FindById<user_coin>(ugOracle.Id);
            Assert.Equal(100000, UserInfoOracle.iduser);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = new TestMySqlPower().Insert(ugMysql);
            var UserInfoMysql = new TestMySqlPower().FindById<usercoin>(ugMysql.Id);
            Assert.Equal(0, UserInfoMysql.iduser);
        }

        [Fact]
        public async Task ExcludeDbInsertAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var dbOracleConnection = new TestAsyncOraclePower().CreateConnectionAsync();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = await new TestAsyncOraclePower().InsertAsync(dbOracleConnection.Result, ugOracle);
            var UserInfoOracle = new TestOraclePower().FindById<user_coin>(ugOracle.Id);
            Assert.Equal(100000, UserInfoOracle.iduser);

            GaeaMySqlPower.Register();
            var gaeaMysqlPower = new TestMySqlPower();
            var dbMysqlConnection = new TestAsyncMySqlPower().CreateConnectionAsync();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = await new TestAsyncMySqlPower().InsertAsync(dbMysqlConnection.Result, ugMysql);
            var UserInfoMysql = new TestMySqlPower().FindById<usercoin>(ugMysql.Id);
            Assert.Equal(0, UserInfoMysql.iduser);
        }

        [Fact]
        public async Task ExcludeInsertAsyncTest()
        {
            GaeaOraclePower.Register();
            var gaeaOraclePower = new TestOraclePower();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = await new TestAsyncOraclePower().InsertAsync(ugOracle);
            var UserInfoOracle = new TestOraclePower().FindById<user_coin>(ugOracle.Id);
            Assert.Equal(100000, UserInfoOracle.iduser);

            GaeaMySqlPower.Register();
            var gaeaMySqlPower = new TestMySqlPower();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = await new TestAsyncMySqlPower().InsertAsync(ugMysql);
            var UserInfoMysql = new TestMySqlPower().FindById<usercoin>(ugMysql.Id);
            Assert.Equal(0, UserInfoMysql.iduser);
        }

        [Fact]
        public void ExcludeUpdateTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = oraclePowerClass.Insert(ugOracle);
            ugOracle.coin = 6;
            ugOracle.iduser = 6;
            oraclePowerClass.Update(ugOracle);

            var UserInfoOracle = oraclePowerClass.FindById<user_coin>(ugOracle.Id);
            Assert.Equal(100000, UserInfoOracle.iduser);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = mysqlPowerClass.Insert(ugMysql);
            ugMysql.coin = 6;
            ugMysql.iduser = 6;
            mysqlPowerClass.Update(ugMysql);

            var UserInfoMysql = mysqlPowerClass.FindById<usercoin>(ugMysql.Id);
            Assert.Equal(0, UserInfoMysql.iduser);
        }

        [Fact]
        public void ExcludeDbUpdateTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            IDbConnection dbOracleConnection = oraclePowerClass.CreateConnection();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = oraclePowerClass.Insert(dbOracleConnection, ugOracle);

            ugOracle.coin = 6;
            ugOracle.iduser = 6;
            oraclePowerClass.Update(dbOracleConnection, ugOracle);
            var UserInfoOracle = oraclePowerClass.FindById<user_coin>(dbOracleConnection, ugOracle.Id);
            Assert.Equal(100000, UserInfoOracle.iduser);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            IDbConnection dbConnection = mysqlPowerClass.CreateConnection();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = mysqlPowerClass.Insert(dbConnection, ugMysql);

            ugMysql.coin = 6;
            ugMysql.iduser = 6;
            mysqlPowerClass.Update(dbConnection, ugMysql);
            var UserInfoMsyql = mysqlPowerClass.FindById<usercoin>(dbConnection, ugMysql.Id);
            Assert.Equal(0, UserInfoMsyql.iduser);
        }

        [Fact]
        public async System.Threading.Tasks.Task ExcludeUpdateAsyncTest()
        {
            GaeaOraclePower.Register();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = await asyncOraclePowerClass.InsertAsync(ugOracle);

            ugOracle.coin = 6;
            ugOracle.iduser = 6;
            await asyncOraclePowerClass.UpdateAsync(ugOracle);
            var TaskUserInfoOracle = asyncOraclePowerClass.FindByIdAsync<user_coin>(ugOracle.Id);
            Assert.Equal(100000, TaskUserInfoOracle.Result.iduser);

            GaeaMySqlPower.Register();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = await asyncMysqlPowerClass.InsertAsync(ugMysql);

            ugMysql.coin = 6;
            ugMysql.iduser = 6;
            await asyncMysqlPowerClass.UpdateAsync(ugMysql);
            var TaskUserInfoMysql = asyncMysqlPowerClass.FindByIdAsync<usercoin>(ugMysql.Id);
            Assert.Equal(0, TaskUserInfoMysql.Result.iduser);
        }

        [Fact]
        public async System.Threading.Tasks.Task ExcludeDbUpdateAsyncTest()
        {
            GaeaOraclePower.Register();
            var asyncOraclePowerClass = new TestAsyncOraclePower();
            var dbOracleConnection = await asyncOraclePowerClass.CreateConnectionAsync();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = await asyncOraclePowerClass.InsertAsync(dbOracleConnection, ugOracle);

            ugOracle.coin = 6;
            ugOracle.iduser = 6;

            await asyncOraclePowerClass.UpdateAsync(dbOracleConnection, ugOracle);
            var TaskUserInfoOracle = await asyncOraclePowerClass.FindByIdAsync<user_coin>(dbOracleConnection, ugOracle.Id);
            Assert.Equal(100000, TaskUserInfoOracle.iduser);

            GaeaMySqlPower.Register();
            var asyncMysqlPowerClass = new TestAsyncMySqlPower();
            var dbMysqlConnection = await asyncMysqlPowerClass.CreateConnectionAsync();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = await asyncMysqlPowerClass.InsertAsync(dbMysqlConnection, ugMysql);

            ugMysql.coin = 6;
            ugMysql.iduser = 6;

            await asyncMysqlPowerClass.UpdateAsync(dbMysqlConnection, ugMysql);
            var TaskUserInfoMysql = await asyncMysqlPowerClass.FindByIdAsync<usercoin>(dbMysqlConnection, ugMysql.Id);
            Assert.Equal(0, TaskUserInfoMysql.iduser);
        }

        [Fact]
        public void ExcludeDeleteTest()
        {
            GaeaOraclePower.Register();
            var oraclePowerClass = new TestOraclePower();
            var ugOracle = new user_coin();
            ugOracle.iduser = 5;
            ugOracle.coin = 5;
            ugOracle.Id = oraclePowerClass.Insert(ugOracle);
            var countOracle = oraclePowerClass.Delete(ugOracle);
            Assert.Equal(1, countOracle);

            GaeaMySqlPower.Register();
            var mysqlPowerClass = new TestMySqlPower();
            var ugMysql = new usercoin();
            ugMysql.iduser = 5;
            ugMysql.coin = 5;
            ugMysql.Id = mysqlPowerClass.Insert(ugMysql);
            var countMysql = mysqlPowerClass.Delete(ugMysql);
            Assert.Equal(1, countMysql);
        }
    }
}
